<script type="text/javascript" src="{TEMPLATE_WEUI}js/dropload.min.js"></script>
<script type="text/javascript" src="{TEMPLATE_WEUI}js/lazyimg.js"></script>
<script type="text/javascript">
$(function(){
	$('#tab').tab({defaultIndex:0,activeClass:"tab-green"});
});  
</script>
<style>
.comments_content{background-color:#fbf9ff;}
.dropload-noData{background-color: #eeeef3;color:#999;}
.comments_content .weui_cells{margin:0 0 5px;}
.moments__post .weui_cell_bd {font-size: 15px;width:100%;}
.moments__post .weui_cell_bd .title {position: relative;}
.moments__post .weui_cell_bd .actionMenu {top: 0px;}
.moments__post .weui_cell_bd .toolbar .timestamp{font-size:12px;}
.moments__post .weui_cell_bd .liketext {margin-top: 5px;padding:2px 5px;width:100%;}
</style>

	<div class="weui_panel weui_cells_access comments" style="margin:0;background-color:#fbf9ff;">
		<div class="comments_content">
		</div>
	</div>
	
<script type="text/javascript">
$(function(){

	var page = 0;
	var size =10;
	var reid ='{$reid}';
	$('.comments').dropload({
		scrollArea : window,
		autoLoad : true,//自动加载
		domDown : {//上拉
			domClass   : 'dropload-down',
			domRefresh : '<div class="dropload-refresh f14"><i class="icon icon-20"></i>上拉加载更多</div>',
			domLoad    : '<div class="dropload-load f14"><span class="weui-loading"></span>正在加载中...</div>',
			domNoData  : '<div class="dropload-noData">没有更多评论了</div>'
		},
		loadDownFn : function(me){//加载更多
			page++;
//			window.history.pushState(null, document.title, window.location.href);	//加载记录页面
			var result = '';
			$.ajax({
				type: 'GET',
				url: '{php echo murl('entry', array('do' => 'getcomment','m' => 'dayu_comment'), true, true)}',
				dataType: 'json',
				data:{page:page,size:size,reid:reid},
				success: function(data){
					var arrLen = data.length;
					if(arrLen > 0){
                        for(var i=0; i<arrLen; i++){
			
	result+='<div class="weui_cells moments"> '
			+'<div class="weui_cell moments__post">'
			+'<div class="weui_cell_hd weui-updown">'
			+'<img class="lazyload" src="" alt="" data-img="'+data[i].avatar+'">'
			+'</div>'
			+'<div class="weui_cell_bd">'
			+'<div class="title" style="margin:0;"><span>'+data[i].nickname+'</span>'
			+'</div>'
			+'<p><span class="ico_scored block"><strong class="score_'+data[i].score+'"></strong></span><small class="f-gray right">'+data[i].time+'</small></p>'
			+'<p id="paragraph" class="paragraph">'+data[i].content+'</p>'
			+'<div class="thumbnails">'+data[i].thumb+'</div>'
			+'<div class="toolbar">'
			+'<small class="timestamp"></small>'
			+'</div>'
			+data[i].contents
			+'</div>'
			+'</div>'
			+'</div>';
}
					}else{
						me.lock();
						me.noData();
					}
                    setTimeout(function(){
                        $('.comments_content').append(result);
						var lazyloadImg = new LazyloadImg({
							el: '.weui-updown [data-img]',
							top: 50,right: 50,bottom: 50,left: 50,
							qriginal: false,
							load: function(el) {
								el.style.cssText += '-webkit-animation: fadeIn 01s ease 0.2s 1 both;animation: fadeIn 1s ease 0.2s 1 both;';
							},
							error: function(el) {

							}
						});
						me.resetload();
					},500);
				},
				error: function(xhr, type){
					$.alert('Ajax error!');
					me.resetload();
				}
			});
		}
	});
//	const menu = $('#actionMenu');
//	const menuBtn = $('#actionToggle');
//	menuBtn.click(function(){menu.toggleClass('active')});
});
function commentsshow(obj){
	wx.previewImage({
		current: obj.getAttribute("data"),
		urls: [obj.getAttribute("data")]
	});
}
</script>